interface KHTMLElement {
    /**
     * 获取样式
     * @param key 样式键
     * @param computed <false> true: 取最终计算样式; false: 只取直接样式;
     * @returns 样式值
     */
    getStyle(key: keyof CSSStyleDeclaration, computed?: boolean): string;
}
{
    Object.defineProperty(KHTMLElement.prototype, 'getStyle', {
        writable: false,
        configurable: false,
        enumerable: false,
        value: U.F.overloading('DOM-getStyle',
            {
                types: [Etype.string],
                fn: function (this: KHTMLElement, key: keyof CSSStyleDeclaration) {
                    const ele = this.ele();
                    return ele ? ele.style.getPropertyValue(U.S.snakeCase(key as string, '-')) : '';
                }
            },
            {
                types: [Etype.string, Etype.boolean],
                fn: function (this: KHTMLElement, key: keyof CSSStyleDeclaration, computed: boolean) {
                    if (computed) {
                        const ele = this.ele();
                        return ele ? window.getComputedStyle(ele).getPropertyValue(U.S.snakeCase(key as string, '-')) : '';
                    } else {
                        return this.getStyle(key);
                    }
                }
            },
        )
    });
}
